/**
 * @date 2006-3-3 13:25:01
 *
 */
package org.nanhill.moo.web.ws.transport;

import java.util.Iterator;
import java.util.List;

import org.nanhill.moo.domain.Category;

/**
 * @author alin [xalinx at gmail dot com]
 * 
 */
public class CategoryVo {
	private String name;

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public CategoryVo() {
	}

	public CategoryVo(String name) {
		this.name = name;
	}

	public static CategoryVo create(Category cg) {
		return new CategoryVo(cg.getName());
	}

	public Category transfer() {
		return new Category(this.name);
	}

	public static CategoryVo[] create(List<Category> cgs) {
		// return cgs.toArray(new CategoryVo[cgs.size()]);
		int len = cgs.size();
		CategoryVo[] acvs = new CategoryVo[len];
		Iterator<Category> itt = cgs.iterator();
		for (int i = 0; i < len; i++) {
			acvs[i] = CategoryVo.create(itt.next());
		}
		return acvs;
	}

}
